#ifndef ZONE_H
#define ZONE_H

extern struct IDirect3DDevice9* d3ddev;

#include <iostream>
#include <vector>
#include <d3d9.h>
#include <d3dx9.h>

using namespace std;

struct CUSTOMVERTEX {FLOAT X, Y, Z, XN, YN, ZN; /*INT R G B;*/ DWORD COLOR;};
#define CUSTOMFVF (D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE)

class Zone
{
    public:

		Zone();
		Zone(float x, float y, float size);

		float getX();
		float getY();
		float getSize();

		int getNbIndices();
		int getNbVertices();

		short * getIndices();
		CUSTOMVERTEX * getVertices();

		void setNbIndices(int size);
		void setNbVertices(int size);

		void setIndices(short *indices);
		void setVertices(struct CUSTOMVERTEX *vertices);

		void toString();
		void render();
		void release();
		void initialize();
 
    private:
 
		float x; // ---------------------------- X coordinate
		float y;  // --------------------------- Y coordinate
		float size; // ------------------------- zone size

		// for memory allocation 
		unsigned int nbIndices; // ------------- number of indices
		unsigned int nbVertices; // ------------ number of vertices

		short *indices; // --------------------- indices' array
		CUSTOMVERTEX *vertices; // ------------- vertices' array

		LPDIRECT3DVERTEXBUFFER9 v_buffer; // --- vertices' buffer 
		LPDIRECT3DINDEXBUFFER9 i_buffer; // ---- indices' buffer

};

#endif